package com.mask.im.business.enums;

import com.mask.im.business.common.exception.BusinessException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author jian
 */

@Getter
@AllArgsConstructor
public enum SendCodeStrategyEnum {
	//发送邮箱注册验证码
	EMAIL_REGISTER_SEND_CODE("emailRSC","emailRegisterSendCodeImpl"),
	//发送手机注册码
	PHONE_REGISTER_SEND_CODE("phoneRSC","phoneRegisterSendCodeImpl"),
	//发送手机登入验证码
	MOBILE_LOGIN("phoneLogin","phoneLoginSendCodeImpl"),
	//发送手机找回密码验证码
	MOBILE_PASSWORD_RECOVERY("phonePRSendCode","phonePasswordRecoverySendCodeImpl"),
	//发送手机账号找回登入名
	MOBILE_ACCOUNT_RECOVERY("phoneARSendCode","phoneRecoveryAccountSendCodeImpl"),
	//发送手机验证码更改绑定
	PHONE_UPDATE_BINDING("phoneUpdateBind","phoneUpdateBindImpl"),
	//发送邮箱找回密码验证码
	EMAIL_PASSWORD_RECOVERY("emailPRSendCode","emailPasswordRecoverySendCodeImpl"),
	//发送邮箱账号找回验证码
	EMAIL_ACCOUNT_RECOVERY("emailARSendCode","emailRecoveryAccountSendCodeImpl"),
	//发送邮箱验证码更改绑定
	EMAIL_UPDATE_BINDING("emailUpdateBind","emailUpdateBindImpl");

	private final String sendCodeType;

	private final String strategy;

	public static String getStrategy(String sendCodeType){
		for (SendCodeStrategyEnum value : SendCodeStrategyEnum.values()) {
			if (sendCodeType.equalsIgnoreCase(value.sendCodeType)){
				return value.strategy;
			}
		}
		throw new BusinessException("错误请求");
	}
}
